package LeetCode.month03.day66;

/**
 * @author 16778
 * @date 2025/9/30 8:05
 * @description
 */
public class No2221 {
    public static void main(String[] args) {
        System.out.println(triangularSum(new int[]{1,2,3,4,5}));
    }
    public static int triangularSum(int[] nums) {
        int n = nums.length;
        if(n==1) return nums[0];
        for (int i = 0; i < nums.length-1; i++) {
            for (int j = 0; j < n-1; j++) {
                nums[j] = (nums[j]+nums[j+1])%10;
            }
            n--;
        }
        return nums[0];
    }
}
